package cc.rengu.oltp.service.common.enums;

/**
 * 限额账户类型枚举
 * Created by 王成 on 2020/2/6.
 */
public enum LimitAcctTypeEnum {
    BANK_DEBIT("00", "本行借记账户"),
    BANK_CREDIT("01", "本行贷记账户"),
    BANK_PASSBOOK("02", "本行存折"),
    BANK_ACCT("03", "本行内部户"),
    BANK_PUB_ACCT("04", "本行对公户"),
    OTHER_DEBIT("10", "他行借记账户"),
    OTHER_CREDIT("11", "他行贷记账户"),
    OTHER_PASSBOOK("12", "他行存折"),
    OTHER_ACCT("13", "他行内部户"),
    OTHER_PUB_ACCT("14", "他行对公户"),
    DEBIT("20", "借记账户"),
    CREDIT("21", "贷记账户"),
    ALL("*", "通用账户");

    private String acctType;
    private String acctDesc;

    LimitAcctTypeEnum(String acctType, String acctDesc) {
        this.acctType = acctType;
        this.acctDesc = acctDesc;
    }

    public String getAcctType() {
        return acctType;
    }

    public void setAcctType(String acctType) {
        this.acctType = acctType;
    }

    public String getAcctDesc() {
        return acctDesc;
    }

    public void setAcctDesc(String acctDesc) {
        this.acctDesc = acctDesc;
    }

    /**
     * 根据账户类型获取账户类型描述
     *
     * @param limitType 账户类型
     * @return 限额类型枚举值
     */
    public static LimitAcctTypeEnum getAcctType(String limitType) {
        for (LimitAcctTypeEnum acctTypeEnum : LimitAcctTypeEnum.values()) {
            if (acctTypeEnum.getAcctType().equals(limitType)) {
                return acctTypeEnum;
            }
        }
        return LimitAcctTypeEnum.ALL;
    }

    /**
     * 根据账户类型获取账户类型描述
     *
     * @param limitType 账户类型
     * @return 账户类型描述
     */
    public static String getAcctTypeDesc(String limitType) {
        for (LimitAcctTypeEnum acctTypeEnum : LimitAcctTypeEnum.values()) {
            if (acctTypeEnum.getAcctType().equals(limitType)) {
                return acctTypeEnum.getAcctDesc();
            }
        }
        return null;
    }
}
